|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The job manager provides facilities for scheduling, querying, and maintaining jobs and locks. In particular, the job manager provides the following services:
schedule
method.This interface is not intended to be implemented by clients.
Job
,
ILock
Method Summary | |
void |
addJobChangeListener(IJobChangeListener listener)
Registers a job listener with the job manager. |
void |
beginRule(ISchedulingRule rule,
IProgressMonitor monitor)
Begins applying this rule in the calling thread. |
void |
cancel(Object family)
Cancels all jobs in the given job family. |
Job |
currentJob()
Returns the job that is currently running in this thread, or null if there is no currently running job. |
void |
endRule(ISchedulingRule rule)
Ends the application of a rule to the calling thread. |
Job[] |
find(Object family)
Returns all waiting, executing and sleeping jobs belonging to the given family. |
void |
join(Object family,
IProgressMonitor monitor)
Waits until all jobs of the given family are finished. |
ILock |
newLock()
Creates a new lock object. |
void |
removeJobChangeListener(IJobChangeListener listener)
Removes a job listener from the job manager. |
void |
setLockListener(LockListener listener)
Provides a hook that is notified whenever a thread is about to wait on a lock, or when a thread is about to release a lock. |
void |
setProgressProvider(ProgressProvider provider)
Registers a progress provider with the job manager. |
void |
shutdown()
Shuts down the job manager. |
void |
sleep(Object family)
Requests that all jobs in the given job family be suspended. |
void |
startup()
Starts up the job manager. |
void |
wakeUp(Object family)
Resumes scheduling of all sleeping jobs in the given family. |
Method Detail |
public void addJobChangeListener(IJobChangeListener listener)
listener
- the listener to be added.public void beginRule(ISchedulingRule rule, IProgressMonitor monitor)
Rules can be nested only if the rule for the inner beginRule is contained within the rule for the outer beginRule. Rule containment is tested with the API method ISchedulingRule.contains. Also, begin/end pairs must be strictly nested. Only the rule that has most recently begun can be ended at any given time.
A rule of null
can be used, but will be ignored for scheduling
purposes. The outermost non-null rule in the thread will be used for scheduling. A
null
rule that is begun must still be ended.
If this method is called from within a job that has a scheduling rule, the given rule must also be contained within the rule for the running job.
Note that endRule must be called even if beginRule fails. The recommended usage is:
final ISchedulingRule rule = ...; try { manager.beginRule(rule, monitor); } finally { manager.endRule(rule); }
This API is experimental, and is subject to change or removal without notice.
rule
- the rule to begin applying in this thread, or null
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
IllegalArgumentException
- if the rule is not strictly nested within
all other rules currently active for this thread.
OperationCanceledException
- if the supplied monitor reports cancelation
before the rule becomes available.ISchedulingRule.contains
public void cancel(Object family)
family
- the job family to cancel, or null
to cancel all jobs.Job.belongsTo(Object)
public Job currentJob()
public void endRule(ISchedulingRule rule)
Rules can be nested only if the rule for the inner beginRule is contained within the rule for the outer beginRule. Also, begin/end pairs must be strictly nested. Only the rule that has most recently begun can be ended at any given time.
This API is experimental, and is subject to change or removal without notice.
rule
- the rule to end applying in this thread
IllegalArgumentException
- if this method is called on a rule for which
there is no matching begin, or that does not match the most recent begin.ISchedulingRule.contains(org.eclipse.core.runtime.jobs.ISchedulingRule)
public Job[] find(Object family)
family
- the job family to find, or null
to find all jobs.Job.belongsTo(Object)
public void join(Object family, IProgressMonitor monitor) throws InterruptedException, OperationCanceledException
If the calling thread owns any locks, the locks may be released during the join if necessary to prevent deadlock. On return from the join, the calling thread will once again have exclusive control of any locks that were owned upon entering the join.
Warning: this method can result in starvation of the current thread if another thread continues to add jobs of the given family.
family
- the job family to join, or null
to join all jobs.monitor
- Progress monitor for reporting progress on how the
wait is progressing, or null
if no progress monitoring is required.
InterruptedException
- if this thread is interrupted while waiting
OperationCanceledException
- if the progress monitor is canceled while waitingJob.belongsTo(Object)
public ILock newLock()
public void removeJobChangeListener(IJobChangeListener listener)
listener
- the listener to be removed.public void setLockListener(LockListener listener)
This method is for internal use by the platform-related plug-ins. Clients should not call this method.
LockListener
public void setProgressProvider(ProgressProvider provider)
This method is for internal use by the platform-related plug-ins. Clients should not call this method.
provider
- the new provider, or null
if no progress
is needed.public void shutdown()
WAITING
or
SLEEPING
states will be canceled. Jobs in the RUNNING
state will be told to stop, but there is no guarantee that they will do so.
If the job manager is already shut down, this method has no effect.
After shutdown, no new jobs can be scheduled with the job manager until startup
is called on it.
Since this method will cause pending work to be canceled, it must only be called by the application when it is shutting down. It is not intended to be called by other plugins.
startup()
public void sleep(Object family)
SLEEPING
state. Jobs that have been put to sleep
will remain in that state until either resumed or canceled. This method has
no effect on jobs that are not currently waiting to be run.
Sleeping jobs can be resumed using wakeUp
.
family
- the job family to sleep, or null
to sleep all jobs.Job.belongsTo(Object)
public void startup()
By default, the job manager's lifecycle is tied to the platform. It is started when the platform starts up, and is shutdown before the platform exits. If plugins choose to shutdown the job manager while the platform is running, it must be restarted using this method before new jobs can be scheduled.
shutdown
public void wakeUp(Object family)
family
- the job family to wake up, or null
to wake up all jobs.Job.belongsTo(Object)
|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |